<?php
/*
 * Required attributes: id: id of the permission, perm: permission (e.g. v for view v|u|d|p|a)
 */

m2import('phpinchains/psp/Tag.php');

class xics_ifpermHandler extends phpinchains_psp_Tag
{

    /**
     * Is a body tag (if false, body is ignored)
     */
    var $tagType = PSP_BODY_TAG;
    /**
     * Tag name in form namespace:tagname
     */
    var $tagName   = 'xics:ifperm';
    
    var $requiredAttributes = array('id' => '*', 'perm' => '(v|u|d|p|a)');
  
    function doStartTag()
    {
		$ctx = & base_ApplicationContext::getInstance();
		$usr = & $ctx->getUsr();
    	if ($usr->checkPermission($this->attrs['id'], $this->attrs['perm']))
    	    return PSP_EVAL_BODY_INCLUDE;
        else
            return PSP_SKIP_BODY;
    }

}
?>